<%@ page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@ page import="beans.*"%>
<%@page import="java.lang.*"%>
<jsp:useBean id="cate" scope="page" class="beans.CatalogoEnti" />
<jsp:useBean id="cats" scope="page" class="beans.CatalogoSede" />
<jsp:useBean id="catente" scope="page" class="beans.CatalogoEnti" />
<jsp:useBean id="catp" scope="page" class="beans.CatalogoPersona" />
<jsp:useBean id="catc" scope="page" class="beans.CatalogoConvenzioni" />
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">



<title><%@ include file="title.jspf" %></title>
<link href="stile.css" rel="stylesheet" type="text/css">
<link rel="icon" href="favicon.ico" type="image/x-icon" />
</head>
<body>
	<div id="top">
		<%@ include file="top.jspf"%>
	</div>


	<div id="container">
		<div id="header">
			<%@ include file="header.jspf"%>
		</div>
		<div id="page">

			<%
				Ente e = new Ente();
				Sede s = new Sede();
				//out.println(s.toString());
				Vector<Ente> VE = new Vector<Ente>();
				VE = cate.getEnti();
%>
			
							<center>
				<form method="GET" action="VisualizzaEnte.jsp">
					<input type="text" name="ricerca" value="Ricerca per codice o nome" required onfocus="if(this.value==this.defaultValue)this.value=''">	
					<input class=bottone type="submit" value="Ricerca" name="B1">
				</form>
				</center>
				
			<table align="center" border="0" width="100%">
				<tr class=intestTab>
					<th>CODICE</th>
					<th>DENOMINAZIONE STRUTTURA E RECAPITI</th>
					
				
				
				</tr>
				
				<%
				Vector<Sede> VS =new Vector<Sede>();
				VS=cats.getSedi();
				Vector<Persona> VP =new Vector<Persona>();
				VP=catp.getPersone();
				
				for (int i = 0; i < VE.size(); i++) {
					int idEnte = VE.get(i).getIdEnte();
					String nome = VE.get(i).getNome();
					int codStruttura=VE.get(i).getCodiceStruttura();
					
					out.println("<tr class=\"d"+i%2+"\"d><td><center><a style=text-decoration:none href=\"Scheda_Ente.jsp?id=" + idEnte+ "\">"+codStruttura+"</a></center></td>");
					
					out.println("<td>&nbsp&nbsp<b><a style=text-decoration:none href=\"Scheda_Ente.jsp?id=" + idEnte+ "\">"+nome+"</a></b>");
					
					if(VS!=null)
						for(int z=0;z<VS.size();z++)
							if(VS.get(z).getIdEnte()==idEnte)
								out.print("<br>&nbsp&nbsp&nbsp<b>"+VS.get(z).getTipologia()+"</b> "+ VS.get(z).getTelefono()+" "+  VS.get(z).getFax() +" "+ VS.get(z).getEmail() );
					if(VP!=null)
						for(int p=0;p<VP.size();p++)
							if(VP.get(p).getIdEnte()==idEnte)
								out.print("<br>&nbsp&nbsp&nbsp<b>"+VP.get(p).getTitoloReferenza()+"</b> "+VP.get(p).getNome()+" "+VP.get(p).getCognome()+" " +VP.get(p).getTelefono()+" "+  VP.get(p).getCellulare() +" "+ VP.get(p).getEmail() );
					
					out.println("</td>");
					out.println("</tr>");
				}
				%>
			</table>




		</div>
		<!-- chiusura del div page-->

		<div id="footer">
			<%@ include file="footer.jspf"%>
		</div>
	</div>
	<!-- chiusura del div container-->

</body>
</html>